import request from '@/utils/request'
const baseUrl = process.env.VUE_APP_BASE_API

// 查询试题列表
export function listQuestion (query) {
    return request({
        url: '/system/question/list',
        method: 'get',
        params: query
    })
}
export function listCourseQuestion (query) {
    return request({
        url: '/system/courseQuestion/list',
        method: 'get',
        params: query
    })
}
// 查询试题详细
export function getQuestion (id) {
    return request({
        url: '/system/question/' + id,
        method: 'get'
    })
}

// 新增试题
export function addQuestion (data) {
    return request({
        url: '/system/question',
        method: 'post',
        data: data
    })
}

// 修改试题
export function updateQuestion (data) {
    return request({
        url: '/system/question',
        method: 'put',
        data: data
    })
}

// 删除试题
export function delQuestion (id) {
    return request({
        url: '/system/question/' + id,
        method: 'delete'
    })
}

// 删除课程-试题
export function delCourseQuestion (courseId, ids) {
    return request({
        url: `/system/courseQuestion/remove`,
        method: 'post',
        data: {
            "courseId": courseId,
            "ids": ids
        }
    })
}

// 导出试题
export function exportQuestion (query) {
    return request({
        url: '/system/question/export',
        method: 'get',
        params: query
    })
}
export function exportTemplate () {
    //   return request({
    //     url: '/system/question/importTemplate',
    //     method: 'get'
    //   })
    window.open(`${baseUrl}/system/question/importTemplate`, 'target')
}
